#include "tetra_vz.h"
#include "iostream"

int main(int argc, char *argv[])
{
	// Declare a tetrahedron
	point3d p[4];
	p[0].x = 20; p[0].y = 50; p[0].z = -5;
	p[1].x = 80; p[1].y = 20; p[1].z = -10;
	p[2].x = 50; p[2].y = 80; p[2].z = -15;
	p[3].x = 50; p[3].y = 50; p[3].z = -40;

	tetrahedron t;
	t.rho = 1.0;
	for (int i = 0; i < 4; i++)
	{
		t.vec_ptr[i] = &p[i];
	}
	t.initialize_tensors();

	// Declare the observation stations
	double xmin = 0, dx = 2.5; // 41
	double ymin = 0, dy = 2.5; // 41
	point3d obs[1681]; // 41*41
	for (int i = 0; i < 41; i++)
	{
		for (int j = 0; j < 41; j++)
		{
			obs[i*41+j].x = xmin + dx*j;
			obs[i*41+j].y = ymin + dy*i;
			obs[i*41+j].z = 0.0;
		}
	}

	// Calculate the gravity values
	for (int i = 0; i < 1681; i++)
	{
		std::cout << obs[i].x << " " << obs[i].y << " ";
		std::cout << tetra_vz(&t, &obs[i]) << std::endl;
	}
	return 0;
}